package com.cloud.spring.demo.entity;

import com.cloud.spring.demo.validation.PhoneValidation;
import lombok.Data;
import org.springframework.stereotype.Component;

import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Component
@Data
public class User {
    @NotNull(message = "id不能为null")
    @Max(value = 20, message = "id的最大值为20")
    private Integer id;
    @Size(max = 20, message = "姓名不能超过20个字符")
    private String name;
    @Email(message = "请输入正确的email")
    private String email;
    @PhoneValidation(message = "请输入正确的手机号")
    private String phone;
    private LocalDate birth;
    private LocalDateTime localDateTime;
}
